package offer.zixing.chapter12;

import java.util.Arrays;

public class Test_3 {
    public static void main(String[] args) {
        int[] arr = {3, 2, 1, 5, 6, 4};
        int kthLargest = findKthLargest(arr, 2);
        System.out.println("kkkkkkkk " + kthLargest);
        print(arr);
    }

    public static int findKthLargest(int[] nums, int k) {
        Arrays.sort(nums);
        return nums[nums.length - k];
    }

    static void print(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
